﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DomainDriver.CommonUtilities.Enums;

namespace DomainDriver.CommonUtilities.UnitTests.Enums
{
    [TestFixture]
    public class EnumUtilitiesTests
    {
        [Test]
        public void VerifyIntToEnumConversion()
        {
            int intValue;
            EnumForTesting enumValue;

            intValue = 0;
            enumValue = EnumUtilities.ConvertIntToEnum<EnumForTesting>(intValue);
            Assert.AreEqual(intValue, (int)enumValue);

            intValue = EnumUtilities.GetMaxEnumValue<EnumForTesting>();
            enumValue = EnumUtilities.ConvertIntToEnum<EnumForTesting>(intValue);
            Assert.AreNotEqual(0, (int)enumValue);
            Assert.AreEqual(intValue, (int)enumValue);
        }

        [Test]
        public void VerifyEnumToIntConversion()
        {
            EnumForTesting enumValue;
            int intValue;

            enumValue = EnumForTesting.TestValue1;
            intValue = EnumUtilities.ConvertEnumToInt<EnumForTesting>(enumValue);
            Assert.AreEqual((int)enumValue, intValue);

            enumValue = EnumForTesting.TestValue3;
            intValue = EnumUtilities.ConvertEnumToInt<EnumForTesting>(enumValue);
            Assert.AreNotEqual((int)EnumForTesting.TestValue1, enumValue);
            Assert.AreEqual((int)enumValue, intValue);
        }
    }
}